package org.phalanx.client.UI;

import java.util.Hashtable;

import javax.swing.JPanel;

public class PhalanxPanelManager {
	private static PhalanxPanelManager p;
	private Hashtable<String,JPanel> panelTable = new Hashtable<String,JPanel>();
	
	synchronized public static PhalanxPanelManager getInstance(){
		if (p == null){
			p = new PhalanxPanelManager();
		}
		return p;
	}
	
	public JPanel getPanel(String panelName){
		JPanel storedPanel = null;
		
		if (panelTable.containsKey(panelName)){
			storedPanel = panelTable.get(panelName);
		}
		return storedPanel;
	}
	
	public void setPanel(String panelName, JPanel panel){
		if (panelName != null && panel != null){
			panelTable.put(panelName, panel);
		}
	}
	
	public void removePanel(String panelName){
		if (panelName != null){
			panelTable.remove(panelName);
		}
	}
}
